const { BrowserWindow, ipcMain, Menu } = require('electron')
const contextMenuTemplate = Menu.buildFromTemplate([{
    label: '复制',
    role: 'copy'
},
    {
        label: '粘贴',
        role: 'paste'
    },
    { type: 'separator' },
    {
        // 分隔线
        label: '其他功能',
        click: () => {
            console.log('click')
        }
    }
])
function MainFunc() {
    ipcMain.on('show-contextmenu', () => {
        const focusedwindow = BrowserWindow.getFocusedWindow()
        if (focusedwindow) {
            contextMenuTemplate.popup({
                window: focusedwindow
            })
        }
    })
}
module.exports = {MainFunc}
